package main

import "fmt"

type Students struct {
	Persons
	score float64
}

type Persons struct {
	id   int
	name string
	age  int
}

func main() {
	stu1 := Students{Persons{101, "张三", 20}, 88.8}
	stu2 := Students{Persons{102, "李四", 20}, 88.8}
	fmt.Println(stu1)
	fmt.Println(stu2)
	fmt.Println(stu2.Persons.id) //输出对应对象的id

	//简化写法,这样也可以拿到
	fmt.Println(stu1.id)

	//修改相应的值
	stu1.score = 100
	stu1.name = "令狐冲"

}
